#ifndef __HET_RINGBUF_h__
#define __HET_RINGBUF_h__


typedef enum rk_BUF_TYPE_E {
	RK_CACHE_TYPE_FIFO = 0,
	RK_CACHE_TYPE_BUF
} RK_CACHE_TYPE_MODE_E;
typedef struct {
    char *buffer;
    char *name;
    size_t bufferSize;
    size_t head;
    size_t tail;
    size_t length;
    size_t minValue;
    RK_CACHE_TYPE_MODE_E cacheType;
    char * bufferAddr;
    pthread_mutex_t mutex;
} RingBuffer;


#ifdef __cplusplus
extern "C" {
#endif

RingBuffer* rb_createRingBuffer(RingBuffer *rbBuf,char * name,size_t size,RK_CACHE_TYPE_MODE_E cacheType) ;
void rb_destroyRingBuffer(RingBuffer *rbBuf) ;
void rb_setMinValue(RingBuffer *rbBuf,size_t value) ;
void rb_reset(RingBuffer *rbBuf) ;
int rb_push(RingBuffer *rbBuf,const char *data, size_t length) ;
int rb_pop(RingBuffer *rbBuf,char *data, size_t length);
size_t rb_size(RingBuffer *rbBuf);
size_t rb_max(RingBuffer *rbBuf);
extern RingBuffer audioPlayBuf;
extern RingBuffer audioRecBuf;
#ifdef __cplusplus
}
#endif
#endif